package com.briup.app02.web.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.briup.app02.bean.AccountCustomer;
import com.briup.app02.bean.AccountEmployee;
import com.briup.app02.bean.AccountSystem;
import com.briup.app02.bean.extend.AccountCustomerExtend;
import com.briup.app02.service.IAccountCustomerService;
import com.briup.app02.service.IAccountEmployeeService;
import com.briup.app02.service.IAccountSystemService;
import com.briup.app02.utils.Message;
import com.briup.app02.utils.MessageUtil;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@RestController
@Validated
@RequestMapping("/account")
@Api(description = "账户相关接口")
public class AccountController {
	@Autowired
	private IAccountCustomerService accountcustomer;
	@Autowired
	private IAccountEmployeeService accountemployee;
	@Autowired
	private IAccountSystemService accountsystem;
	
	//-----------------------------------------------------
	@GetMapping("/findAllCustomer")
	@ApiOperation("查询所有客户")
	public List<AccountCustomer> findAllCustomer(){
		return accountcustomer.findAll();
	}
	//-----------------------------------------------------
	@GetMapping("/findAllEmployee")
	@ApiOperation("查询所有雇员账户")
	public List<AccountEmployee> findAllEmployee(){
		return accountemployee.findAll();
	}
	//-----------------------------------------------------
	@GetMapping("/findAllSystem")
	@ApiOperation("查询所有账户")
	public List<AccountSystem> findAllSystem(){
		return accountsystem.findAll();
	}
	//-----------------------------------------------------
	@GetMapping("/pageQueryCustomerAccount")
	@ApiOperation("分页查询顾客账户")
	public Message pageQueryCustomerAccount(int page, int pageSize, String status,String type,Long beginTime,Long endTime,Long user_id) {
		List<AccountCustomerExtend> accountcustomerlists=accountcustomer.pageQuery(page, pageSize, status,type,beginTime,endTime,user_id); 
		return MessageUtil.success(accountcustomerlists);
	}
	//-----------------------------------------------------
	@GetMapping("/pageQueryEmployeeAccount")
	@ApiOperation("分页查询雇员账户")
	public Message pageQueryEmployeeAccount(int page, int pageSize, String status,String type,Long beginTime,Long endTime,Long user_id) {
		List<AccountEmployee> accountcustomerlists=accountemployee.pageQuery(page, pageSize, status,type,beginTime,endTime,user_id); 
		return MessageUtil.success(accountcustomerlists);
	}
	//-----------------------------------------------------
	@GetMapping("/pageQuerySystemAccount")
	@ApiOperation("分页查询系统账户")
	public Message pageQuerySystemAccount(int page, int pageSize, String status,String type,Long beginTime,Long endTime) {
		List<AccountSystem> accountcustomerlists=accountsystem.pageQuery(page, pageSize, status,type,beginTime,endTime); 
		return MessageUtil.success(accountcustomerlists);
	}
		
}
